<extend name="Base/common" />

<block name="style">
    <!-- 引入css -->
    <load  href ="__CSS__/account/personAddr.css"/>
    <load  href ="__CSS__/account/city-picker.css"/>
    <load  href ="__CSS__/account/common.css"/>
    <load  href ="__CSS__/account/r3common.css"/>
    <load  href ="__CSS__/account/checkout.css"/>
    <!-- 引入js -->
    <load  href ="__JS__/account/jquery-1.10.2.min.js"/>
    <load  href ="__JS__/account/arvato_touch.js"/>
    <load  href ="__JS__/account/jquery.js"/>
    <load  href ="__JS__/account/city-picker.data.js"/>
    <load  href ="__JS__/account/city-picker.js"/>
</block>

<block name="body">
    <!-- 头部订单面包屑 -->
    <div class="addCartOverlay"></div>
    <div class="checkoutBcBox cf">
        <div class="wrapper">
            <span class="cur"><em>1</em>填写订单</span>
            <span class=""><em>2</em>订单确认</span>
            <span class="checkComplete"><em>3</em>支付订单</span>
        </div>
    </div>

    <div class="sticky_proxy" style="height:6px;">&nbsp;</div>
    <!--start login & register -->
    <div class="checkoutBox">
        <!--start wrapper min-width:950px-->
        <div class="wrapper cf">
            <!--start left aside col4-1-->
            <div class="col4-1">
                <!-- 地址表单  -->
                <form action="{:U('cart/vieworder')}" method="post" id="co-shipping-form"  name="form1"   class="yan-chekcout">
                    <h3 class="font24">配送地址</h3>
                    <!--  地址如果为空 -->
                <empty name="addres">
                    <!-- 收货人 -->
                    <div class="w200 ">
                        <div class="commonInputBox">
                            <input type="text" class="textInput commonInput required" id="shipping_firstname" name="shipping[firstname]" placeholder="* 收货人" value="">
                        </div>
                    </div>
                    <input type="hidden" id="shipping_country_id" class="validate-select" name="shipping[country_id]" value="CN">
                    <div class="mt20 shipAddrSelect cf">
                        <div class="copySelect" id="shipping_region_div">
                            <div class="mydiv" style="padding:0;height:47px;width:500px;">
                                <!-- 全国三级联动js开始 -->
                                <div id="distpicker" style="width:40px;">
                                  <!-- <div class="form-group"> -->
                                    <div style="position: relative;">
                                      <input id="city-picker3" name="area" class="form-control" readonly type="text" data-toggle="city-picker">
                                    </div>
                                  <!-- </div> -->
                                </div>
                                <!-- 全国三级联动 -->
                            </div>
                        </div>
                    <!--end other select-->
                    </div>

                    <!-- 详细地址 -->
                    <div class="w500 mt20">
                        <div class="commonInputBox">
                            <input type="text" placeholder="* 详细地址" name="shipping[street][]" id="shipping_street1" value="" class="textInput commonInput required">
                        </div>
                    </div>
                    <!-- 邮编 -->
                    <div class="w200 mt20">
                        <div class="commonInputBox">
                        <input type="text" placeholder="* 邮编" name="shipping[postcode]" id="shipping_postcode" value="" class="textInput commonInput required">
                        </div>
                    </div>
                    <!-- 电话 -->
                    <div class="w500 shipTel cf mt20">
                        <div class="commonInputBox fl w160">
                            <input type="text" name="shipping[mobile]" value="" placeholder="* 手机" class="textInput commonInput  mobile" id="shipping_mobile">
                        </div>
                        <div class="fl fixTelTxt">或 固定电话</div>
                        <div class="commonInputBox fl w65">
                            <input type="text" name="shipping[tel_areacode]" value="" class="textInput commonInput areacode" id="shipping_tel_areacode">
                        </div>
                        <div class="fl fixTelSpilt">-</div>
                        <div class="commonInputBox fl w160">
                            <input type="text" name="shipping[telephone]" value="" class="textInput commonInput telephone" id="shipping_telephone">
                        </div>
                    </div>
                    <load href="__JS__/account/validate.js" />

                    <!-- 收货地址为空时，显示保存地址按钮 -->
                    <div style="margin-top:11px;">

                        <div class="checkoutConfirm">
                            <a onclick="addrinfo(this)" class=" btnCommon btnBlueLinear btnArrow w200 fl" id="save_address" >保存地址<em></em></a>
                        </div>
                    </div>

                    <!--start shipping address info-->
                    <else />

                    <foreach name="addres" item="val">
                        <input type="hidden" name="addr_id" value="{$val['addr_id']}">
                        <input type="hidden" name="user_id" value="{$val['user_id']}">
                        <input type="hidden" name="jifen"  id="jifen" value="">
                    <style media="screen">
                        .address{font-size:16px;font-family:黑体;width:500px;padding:10px;border:1px dotted gray;margin-bottom: 15px;}
                        .address p{line-height:25px;}
                        .address span{font-weight:bold;}
                    </style>

                    <div class="address" style="">
                        <p><span>收货人: </span>{$val['receiver']}</p>
                        <p><span>电　话: </span>{$val['phone']}</p>
                        <p><span>邮　编: </span>{$val['postcode']}</p>
                        <p><span>地　址:</span> {$val['province']}/{$val['city']}/{$val['country']}/{$val['addr_detail']}</p>
                    </div>
                </foreach>
                    <!-- 若有地址数据，且用户需要新增收货地址，跳转到个人中心新增收货地址 -->
                    <a href="{:U('personCenter/personCenter',array('user_id'=>$chek_session['user_id']))}" style="font-size: 15px;color:#0286CD;margin-top:20px;display: block;font-family: 黑体;">+ 新增收货地址</a>
                </empty>
                    <!--end shipping address info-->

                    <!-- 送货备注 -->
                    <span id="addrinfo" style="color:green;font-size:16px;"></span>
                    <div class="w500 mt20 cb"> <span class="checkoutInputTit">送货备注</span>
                        <div class="commonInputBox">
                        <textarea class="textareaInput commonInput" title="送货备注" name="shipping" rows="5" cols="45" id="shipping_delivery_memo"></textarea>
                        </div>
                        <span class="shipAdrRemarkTip">请限制在120字数以内</span>
                    </div>

                    <!--start payment-->
                    <div class="deliveryM borderTop updataClassAdress">
                        <h3 class="font24">配送方式</h3>
                        <div class="checkStock radioBionic  cf radioEvent">
                            <p class="deliveryT1 delivery_typep cf" style="font-weight:normal"> <b>普通快递</b>  完成订单支付后48小时内安排发货。
                                <span class="radio-view " >
                                    <em id="checksend" class="cuu"></em>
                                    <input name="delivery_type" type="radio">
                                </span>
                            </p>
                        </div>
                    </div>
                    <!--start payment-->
                    <div class="integral borderTop">
                        <h3 class="font24">积分</h3>
                        <div class="checkoutGoTwo w500 checkStock checkBox radioBionic cf radioEvent">
                            <p class="fl">

                                <span><b> &nbsp;&nbsp;使用积分抵扣:</b> <em class="colorMidBlue"></em> 积分 ( <em class="colorMidBlue">可使用{$inter}  积分，兑换 (¥<span class="integrals">　{$inter/10}　</span>)</em> ) </span>
                                <span  id="jifenview" class="radio-view " >
                                    <em id="checkintegral"></em>
                                    <input name="jifen" type="radio">
                                </span>
                            </p>
                            <a href="" class="moreIntegral fl">查看详情</a>
                        </div>
                    </div>
                    <!-- 支付方式 -->
                    <div class="checkPaymentBox borderTop">
                        <h3 class="font24">支付方式</h3>
                        <div id="payment-lists">
                            <div class="checkStock radioBionic  cf radioEvent">
                                <foreach  name="data" item="val">
                                    <p class="bankpay"><span><img src="__IMG__/account/{$val['image']} " width="135" alt="{$val['name']}"></span>
                                    <span class="radio-view checkpay">
                                        <em class="payway"></em>
                                        <input type="hidden" name="test"  class="haha" value="">
                                        <input  name="payment[alipay_pay_bank]" title="{$val['name']}" type="radio" value="{$val['id']}">
                                    </span></p>
                                </foreach>
                            </div>
                            <!--end payment-->
                        </div>
                    </div>

                    <!--end invoice inof-->
                    <div class="mt60 checkoutConfirm" style="margin-top: 20px;">
                        <span>亲爱的顾客，adidas官方旗舰店仅通过外拨客服电话021-25256040与您进行沟通，任何其他形式（如手机、QQ、非官方客服账号）的沟通，包括首位0开头的0-4008801515电话均为诈骗信息，请勿轻信，以免造成财产损失。
                        </span>
                       <br><br>
                       <span class="tishi" style="color:red;margin-left:-90px;font-size:16px;padding:5px;">
                       </span>
                        <a href="javascript:document.form1.submit();" title="确认下单" id="comfirm_order" class="btnCommon btnBlueLinear btnArrow w200 fl">确认下单<em></em></a>
                        <a href="{:U('Cart/showcart')}" title="返回购物车修改" class="checkoutContinue fl">返回购物车修改</a>
                    </div>
                    <!--end go next step btn-->
                </form>
            </div>
            <!--end left aside col4-1-->
            <!--start right aside col4-->
            <div class="col4 last">

                <div class="orderSummary">
                    <h3>订单摘要：<small>共{$cart['sub_num']}件</small></h3>
                    <div class="contentBox">
                        <div class="item">
                            商品总额 ¥<span class="moneyjian">{$cart['sub_total']}</span>
                        </div>
                        <div class="item">
                            优惠总额 <span class="youhui">¥0.00</span>
                        </div>
                        <div class="item delivery">
                            运费 <span id="item_shipping_fee">¥0.00</span>
                        </div>
                        <div class="item total">
                            商品总计¥<span class="moneyjian">{$cart['sub_total']}</span>
                        </div>

                        <div class="proList">
                            <foreach name="carts['list']" item="val">

                            <ul>
                                <li>
                                    <div class="img">
                                        <img src="{$val['image']}">
                                    </div>
                                    <div class="text">
                                        <p class="name">{$val['goods_name']}</p>
                                        <p class="info">BA8672</p>
                                        <p class="info">颜色：{$val['color']}</p>
                                        <p class="info">尺码： {$val['size']}    </p> <br>
                                        <p class="price">{$val['num']}x <span>¥{$val['price']}</span></p>
                                        <p class="price">小计: <span>¥{$val['num'] * $val['price']}</span></p>
                                    </div>
                                </li>
                            </ul>
                            </foreach>
                        </div>
                    </div>
                </div>

                <div class="infoBox">
                    <h4>帮助？</h4>
                    <a href="">关于订单</a><br>
                    <a href="">验收验货</a><br>
                    <a href="">物流配送</a><br>
                    <a href="">售后服务</a>
                </div> &nbsp;
                <div class="infoBox">
                    <h4>我们接受下列付款方式</h4>
                    <img src="__IMG__/account/pay.jpg">
                </div>
            </div>
            <!--end right aside col4-->
        </div>
        <!--end wrapper min-width:950px-->
    </div>
    <!--end login & register -->
</block>

<block name="script">
    <script>
        /* 是否需要发票 */
        $(".checkbill").click(function(){
            $(".bill").toggleClass('cuu');
        });

        /*  送货备注 */
        $(function(){
            $("#shipping_delivery_memo").blur(function(){
                var shipping_delivery_memo = $("#shipping_delivery_memo").val().replace(/\s/g, "");
                  var deliveryLength=shipping_delivery_memo.length;
                  if (deliveryLength > 120) {
                      $(this).parent('.commonInputBox').find('.errormessage').remove();
                      $(this).parent('.commonInputBox').addClass('errorInput');
                      $(this).parent('.commonInputBox').append('<span class="errormessage">您输入的内容过长</span>');

                  }else{
                      if ($(this).parent('.commonInputBox').hasClass('errorInput')) {
                          $(this).parent('.commonInputBox').removeClass('errorInput');
                          $(this).parent('.commonInputBox').find('.errormessage').remove();
                      }
                  }
            });
            $("#shipping_delivery_memo").focus(function() {
              if ($(this).parent('.commonInputBox').hasClass('errorInput')) {
                  $(this).parent('.commonInputBox').removeClass('errorInput');
                  $(this).parent('.commonInputBox').find('.errormessage').remove();
              }
            });
        });

        /*  支付宝付款   */
       $("#abb").click(function(){
           $("#zhifubao").toggleClass('cuu');
       });




        /* 是否使用积分  */
        var sign = true;
        $('#jifenview').click(function(){
            if (sign) {
                $("input[name='jifen']").val(50);
                sign = false;
            }else{
                $("input[name='jifen']").val(0);
                sign = true;
            }

            $(this).find("#checkintegral").toggleClass('cuu');
            var moneyji = $(this).parent().find('.integrals').html();
            moneyji = parseInt(moneyji);
            var moneyjian = $('body').find('.moneyjian').html();
            var jian = moneyjian - moneyji;
            $('body').find('.moneyjian').html(jian);
        });


        $(function(){
            var ok1 = false;
            var t = '';
            /* 其他支付方式选择  */
            $(".checkpay").click(function(){
                $('.payway').each(function(i){
                    $('.payway').eq(i).removeClass('cuu');
                });
                $(this).children().eq(0).toggleClass('cuu');
                $(this).children().eq(1).val(1);

                var title = $(this).children().eq(1).val();
                if (title) {
                    ok1 = true;
                }
            });
            //点击事件判断,如果ok1是对的,则其通过,否则禁用
            $('.btnCommon').click(function(){
                if (ok1) {
                }else{
                    $(this).prev().html("请选择付款方式");
                    return false;
                }
            });
        });

        //ajax提交生成地址表
        function  addrinfo(){
            // alert(222);
            // 收货人
            // var userid   = []
            var name     = $('#shipping_firstname').val();
            //收货区域
            var area     = $('.form-control').val();
            //详细地址
            var street   = $('#shipping_street1').val();
            //邮编
            var postcode = $('#shipping_postcode').val();
            //电话
            var phone    = $('#shipping_mobile').val();
            //备注
            // var remake   = $('#shipping_delivery_memo').val();
            //ajax提交
            $.post("{:U('addrinfo')}",{name:name,area:area,street:street,postcode:postcode,phone:phone},function(data){
                if(data){
                    alert('新增地址成功！');
                    history.go(0);
                }
            });
        }

    </script>
</block>

<block name="footer">
    <!-- 尾部style 可以改为模板引入方式-->
    <style media="screen">
    .f{
        width:100%;
        height:55px;
        background:black;
    }

    .f-wrap{
        width:300px;
        margin:0 auto;
        padding-top:15px;
        float:left;
    }

    .footContry{
        width:140px;
        padding:20px 0;
        float:left;
        margin-left:200px;
    }

    .Contry-icon{
        width:17px;
        height:15px;
        background:url(__PUBLIC__/Home/images/footer/common_sprite.png) no-repeat -15px 0;
        display:inline-block;
        vertical-align:middle;
    }

    .footContry a{
        color:#363738;
        text-decoration:none;
        font-size:13px;
        font-family:微软雅黑;
        font-weight:bold;
    }
    .weibo-icon{
        width:27px;
        height:24px;
        background:url(__PUBLIC__/Home/images/footer/common_sprite.png) no-repeat -60px 0;
        cursor:pointer;
        display:inline-block;
    }

    .weibo-icon:hover{
        width:27px;
        height:24px;
        background:url(__PUBLIC__/Home/images/footer/common_sprite.png) no-repeat -60px -24px;
    }

    .weixin-icon{
        width:27px;
        height:24px;
        background:url(__PUBLIC__/Home/images/footer/common_sprite.png) no-repeat -31px 0;
        cursor:pointer;
        display:inline-block;
    }

    .weixin-icon:hover{
        width:27px;
        height:24px;
        background:url(__PUBLIC__/Home/images/footer/common_sprite.png) no-repeat -31px -24px;
        cursor:pointer;
    }
    .footCopyRight{
        width:468px;
        float:right;
        margin-right:200px;
    }


    .copyright-ul li{
        list-style:none;
        float:left;
        margin-right:15px;
        color:#363738;
        font-size:12px;
        font-family:微软雅黑;
        height:40px;
        line-height:40px;
        padding-top:8px;
    }

    .copyright-ul li a{
        text-decoration:none;
        color:#363738;
    }

    .copyright-ul li a:hover{
        color:gray;
    }
    </style>
    <div class="f">
        <div class="footContry">
            <div class="Contry-icon"></div>
            <a href="#">中国</a>
        </div>
        <div class="f-wrap">
            <div class="weibo-icon"></div>
            <div class="weixin-icon"></div>
        </div>

        <div class="footCopyRight">
            <ul class="copyright-ul">
                <li><a href="#">货物所有权转移</a></li>
                <li><a href="#">法律声明</a></li>
                <li><a href="#">隐私条款</a></li>
                <li>苏ICP备14048805号-1</li>
                <li>© 2016 adidas</li>
            </ul>
        </div>
    </div>
</block>
